SetCompress force
SetCompressor bzip2

# [Installer Attributes]
Name "Dev-C++ 5 beta 8 release (4.9.8.0)"
OutFile "setup.exe"
Caption "Dev-C++ 5 beta 8 release (4.9.8.0)"

# [Licence Attributes]
LicenseText "Dev-C++ is distributed under the GNU General Public License :"
LicenseData "copying.txt"

# [Directory Selection]
InstallDir "C:\Dev-Cpp"
DirShow show
DirText "Select the directory to install Dev-C++ to :"

# [Additional Installer Settings ]
ShowInstDetails show
AutoCloseWindow false
SilentInstall normal
CRCCheck on
SetCompress auto
SetDatablockOptimize on
SetOverwrite ifnewer

InstType "Typical" ;1
InstType "Compact" ;2

ComponentText "Choose components"

# [Background Gradient]
BGGradient off

# [Files]
Section "Dev-C++ program files (required)"
SectionIn 1 2
SetOutPath $INSTDIR
WriteUninstaller uninstall.exe
File "devcpp.exe"
File "copying.txt"
File "News.txt"
File "packman.exe"
SetOutPath $INSTDIR\Lang
File "Lang\*"
SetOutPath $INSTDIR\Templates
File "Templates\*"
SectionEnd

Section "Example files"
SectionIn 1
SetOutPath $INSTDIR
File /r "Examples"
SectionEnd

Section "Help files"
SectionIn 1
SetOutPath $INSTDIR\Help
File "Help\DevCpp.hlp"
File "Help\DevCpp.cnt"
SectionEnd

Section "Icon files"
SectionIn 1
SetOutPath $INSTDIR\Icons
File "Icons\*.ico"
#SetOutPath $INSTDIR\Themes
#File /r "Themes\*"
SectionEnd

Section "Updater and bug reporter (vUpdate/vRoach)"
SectionIn 1 2
SetOutPath $INSTDIR
File "vUpdate.exe"
File "vRoach.exe"
SectionEnd

# [File association]
Section "Associate C and C++ files to Dev-C++"
SectionIn 1 2
StrCpy $0 $INSTDIR\DevCpp.exe
StrCpy $1 $INSTDIR\PackMan.exe

WriteRegStr HKCR ".dev" "" "DevCpp.dev"
WriteRegStr HKCR ".c" "" "DevCpp.c"
WriteRegStr HKCR ".cpp" "" "DevCpp.cpp"
WriteRegStr HKCR ".h" "" "DevCpp.h"
WriteRegStr HKCR ".hpp" "" "DevCpp.hpp"
WriteRegStr HKCR ".rc" "" "DevCpp.rc"
WriteRegStr HKCR ".devpak" "" "DevCpp.devpak"
WriteRegStr HKCR ".devpackage" "" "DevCpp.devpackage"
WriteRegStr HKCR ".template" "" "DevCpp.template"

WriteRegStr HKCR "DevCpp.dev" "" "Dev-C++ Project File"
WriteRegStr HKCR "DevCpp.dev\DefaultIcon" "" '$0,2'
WriteRegStr HKCR "DevCpp.dev\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.c" "" "C Source File"
WriteRegStr HKCR "DevCpp.c\DefaultIcon" "" '$0,3'
WriteRegStr HKCR "DevCpp.c\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.cpp" "" "C++ Source File"
WriteRegStr HKCR "DevCpp.cpp\DefaultIcon" "" '$0,4'
WriteRegStr HKCR "DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.h" "" "C Header File"
WriteRegStr HKCR "DevCpp.h\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.h\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.hpp" "" "C++ Header File"
WriteRegStr HKCR "DevCpp.hpp\DefaultIcon" "" '$0,6'
WriteRegStr HKCR "DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.rc" "" "Resource Source File"
WriteRegStr HKCR "DevCpp.rc\DefaultIcon" "" '$0,7'
WriteRegStr HKCR "DevCpp.rc\Shell\Open\Command" "" '$0 "%1"'

WriteRegStr HKCR "DevCpp.devpak" "" "Dev-C++ Package File"
WriteRegStr HKCR "DevCpp.devpak\DefaultIcon" "" '$0,8'
WriteRegStr HKCR "DevCpp.devpak\Shell\Open\Command" "" '$1 "%1"'

WriteRegStr HKCR "DevCpp.devpackage" "" "Dev-C++ Package File"
WriteRegStr HKCR "DevCpp.devpackage\DefaultIcon" "" '$0,9'
WriteRegStr HKCR "DevCpp.devpackage\Shell\Open\Command" "" '$1 "%1"'

WriteRegStr HKCR "DevCpp.template" "" "Dev-C++ Template File"
WriteRegStr HKCR "DevCpp.template\DefaultIcon" "" '$0,10'
WriteRegStr HKCR "DevCpp.template\Shell\Open\Command" "" '$0 "%1"'
SectionEnd

# [Shortcuts]
Section "Create shortcuts in Start Menu"

MessageBox MB_YESNO "Do you want to install Dev-C++ for all users on this computer ?" IDYES AllUsers
SetShellVarContext current
AllUsers:
SetShellVarContext all

SectionIn 1 2
CreateDirectory "$SMPROGRAMS\Bloodshed Dev-C++"
SetOutPath $INSTDIR
CreateShortCut "$SMPROGRAMS\Bloodshed Dev-C++\Dev-C++.lnk" "$INSTDIR\devcpp.exe"
CreateShortCut "$SMPROGRAMS\Bloodshed Dev-C++\License.lnk" "$INSTDIR\copying.txt"
SectionEnd

Section "Create Quick Launch shortcut"
SectionIn 1 2
CreateShortCut "$QUICKLAUNCH\Dev-C++.lnk" "$INSTDIR\devcpp.exe"
SectionEnd

;called when the user hits the 'cancel' button
Function .onUserAbort
MessageBox MB_YESNO "Abort install?" IDYES NoCancelAbort
Abort
NoCancelAbort:
FunctionEnd

Function .onInit
MessageBox MB_OK "Welcome to Dev-C++ install program. Please do not install this version of Dev-C++ over an existing installation."
FunctionEnd

;called when the install was successful
Function .onInstSuccess
Exec "$INSTDIR\devcpp.exe"
FunctionEnd

# [UnInstallation]

UninstallText "This program will uninstall Dev-C++, continue ?"
ShowUninstDetails show

Section "Uninstall"
Delete "$SMPROGRAMS\Bloodshed Dev-C++\Dev-C++.lnk"
Delete "$QUICKLAUNCH\Dev-C++.lnk"
Delete "$SMPROGRAMS\Bloodshed Dev-C++\License.lnk"
RMDir "$SMPROGRAMS\Bloodshed Dev-C++"
DeleteRegKey HKCR ".dev"
DeleteRegKey HKCR ".c"
DeleteRegKey HKCR ".cpp"
DeleteRegKey HKCR ".h"
DeleteRegKey HKCR ".hpp"
DeleteRegKey HKCR ".rc"
DeleteRegKey HKCR ".devpak"
DeleteRegKey HKCR ".devpackage"
DeleteRegKey HKCR ".template"

DeleteRegKey HKCR "DevCpp.dev"
DeleteRegKey HKCR "DevCpp.c"
DeleteRegKey HKCR "DevCpp.cpp"
DeleteRegKey HKCR "DevCpp.h"
DeleteRegKey HKCR "DevCpp.hpp"
DeleteRegKey HKCR "DevCpp.rc"
DeleteRegKey HKCR "DevCpp.devpak"
DeleteRegKey HKCR "DevCpp.devpackage"
DeleteRegKey HKCR "DevCpp.template"

MessageBox MB_OK "Dev-C++ has been uninstalled. Please now delete the $INSTDIR directory if it doesn't contain some of your documents"

SectionEnd

#eof!